<template>
  <div class="tabbar">
    <div class="container">
      <router-link
        class="tab-item"
        v-for="tab in tabs"
        :key="tab.icon"
        :to="tab.to"
      >
        <span class="tab-link-icon" :class="tab.icon"> </span>
        <div class="tab-link-title">
          {{ tab.name }}
        </div>
      </router-link>
    </div>
  </div>
</template>

<script>
export default {
  name: "tabbar",
  data() {
    return {
      tabs: [
        {
          to: "/",
          name: "首页",
          icon: "iconfont icon-home",
        },
        {
          to: "/discovery",
          name: "发现",
          icon: "iconfont icon-game",
        },
        {
          to: "/news",
          name: "动态",
          icon: "iconfont icon-mark",
        },
        {
          to: "/toplist",
          name: "排行榜",
          icon: "iconfont icon-upstage",
        },
      ],
    };
  },
};
</script>

<style lang="scss" scoped>
.tabbar {
  box-shadow: 0 -0.1px 5px rgb(50 98 110);
  position: absolute;
  border: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8vh;
  .container {
    height: 100%;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    .tab-item {
      line-height: 1.5em;
      display: flex;
      height: 100%;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      flex: 1;
      color: gray;
      text-align: center;
      .tab-link-title {
        color: gray;
        font-size: $subTitleFontSize;
      }
      .tab-link-icon {
        font-size: 0.4rem;
      }
      &.router-link-exact-active {
        .tab-link-icon,
        .tab-link-title {
          color: $themeColor;
        }
      }
    }
  }
}
</style>
